/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kidIcarus.tools;

import com.kidIcarus.model.value.Value;
import com.kidIcarus.weapon.WeaponCompleted;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JLabel;

/**
 *
 * @author squarezty
 */
public class ComboBoxUtil {

    JLabel jValue;
    JLabel jWeaponPicture;
    
    String picType;
    String picId;

    public void setPicType(String picType) {
        this.picType = picType;
    }

    public void setPicId(String picId) {
        this.picId = picId;
    }

    public ComboBoxUtil(JLabel jWeaponPicture, JLabel jValue) {
        this.jWeaponPicture = jWeaponPicture;
        this.jValue = jValue;
    }

    public ComboBoxUtil() {
    }

    public JLabel getjValue() {
        return jValue;
    }

    public void setjValue(JLabel jValue) {
        this.jValue = jValue;
    }

    public void action(WeaponCompleted weapon) {
        String str = String.valueOf(weapon.value());
        if (str.length() < 5) {
            jValue.setText(str.substring(0, 4));
        } else {
            jValue.setText(str.substring(0, 5));
        }
    }
    
    public String[] comboBoxModel(List<Value> list){
        String[] str=new String[list.size()];
        for(int i=0;i<list.size();i++){
            str[i]=list.get(i).getId();
        }
        return str;
    }
    
    public void setPicture() {
        String src = "com/kidIcarus/resources/imgs/en/";
        src = src + picType + "/" + "085" + "-AKDP.jpg";
        jWeaponPicture.setIcon(new ImageIcon(src));
    }
}
